package main.java.LeetCode.CommonSolution;

import java.util.HashMap;
import java.util.Set;

@SuppressWarnings("ALL")
public class TriesNode {

    private final HashMap<Character, TriesNode> nodes;
    private final HashMap<Character,Integer> countes;
    private final HashMap<Character,Boolean> ends;

    public boolean getKeyEnd(Character key){
        return ends.get(key);
    }
    public void setKeyEnd(Character key,boolean isEnd){
        ends.put(key,isEnd);
    }

    public void setKeyCounte(Character key,Integer counte){
        countes.put(key,countes.get(key)+counte);
    }

    public void initKeyCounte(Character key){
        countes.put(key,0);
    }

    public void initKeyNode(Character key){
        nodes.put(key,new TriesNode());
    }

    public void initKeyEnd(Character key){
        ends.put(key,false);
    }

    public void initKeys(Character key){
        this.initKeyCounte(key);
        this.initKeyNode(key);
        this.initKeyEnd(key);
    }

    public boolean isContainsKey(Character key){
        return nodes.containsKey(key);
    }

    public int getKeyCount(Character key){
        return countes.get(key);
    }

    public TriesNode getKeyNode(Character key){
        return nodes.get(key);
    }

    public Set<Character> getAllKey(){
        return nodes.keySet();
    }

    private HashMap<Character,TriesNode> getNodes(){
        return this.nodes;
    }

    private HashMap<Character,Integer> getCountes(){
        return this.countes;
    }

    private HashMap<Character,Boolean> getEnds(){
        return this.ends;
    }



    public TriesNode(){
        nodes = new HashMap<>();
        countes = new HashMap<>();
        ends = new HashMap<>();
    }

}
